<?php

namespace Qy\Controller;

use Qy\Controller\QyBaseController;

/**
 * 学习中心-课程
 */
class CategoryController extends QyBaseController {

    public function index() {
        $objSpecialty = M('Specialty');
        $specialtyList = $objSpecialty->field('specialty_id,cate_id,specialty_name,specialty_img,description,sort')->where(array('status' => 1))->order('sort ASC')->select();
        foreach ($specialtyList as &$val) {
            $val['lock_status'] = 1;
            $val['specialty_img'] =C('ADMIN_URL').$val['specialty_img'];
        }
        unset($val);
        $arrAllCategory = M('CategoryAll')->where(array('type' => 1))->order('cate_id ASC')->select();
        $selfSpecialty = array();
        $otherSpecialty = array();
        foreach ($arrAllCategory as &$val) {
            $val['is_ability_check'] = 1;
            foreach ($specialtyList as $vv) {
                if ($val['cate_id'] == $vv['cate_id']) {
                    $val['specialty'][] = $vv;
                }
                
            }
        }
        unset($val);
        $this->returnList($arrAllCategory);
    }
}
